function Test(name, age) {
    this.name = name;
    this.age = age;
}
Test.prototype.sayName = function () {
    console.log(this.name);
};

function create(Con, ...args) {
    let obj = new Object();
    Object.setPrototypeOf(obj, Con.prototype);
    let ret = Con.apply(obj, args);

    return ret instanceof Object ? ret : obj;
}

const a = create(Test, "func", 26);
console.log("🚀 ~ file: new.js ~ line 18 ~ a", a);

a.sayName();
